<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <style type="text/css">
        body, html {
            width: 100%;
            height: 100%;
            margin:0;
            font-family:"微软雅黑";
        }
        #container{
            width:100%;
            height:100%;
        }
        #result{
            position: fixed;
            top: 10px;
            left: 20px;
            width: 300px;
            height: 40px;
            line-height: 40px;
            text-align: center;
            background: #fff;
            box-shadow: 0 2px 6px 0 rgba(27, 142, 236, 0.5);
            border-radius: 7px;
            z-index: 99;
        }
    </style>
    <script type="text/javascript" src="//api.map.baidu.com/api?type=webgl&v=1.0&ak=DzGqTts9QLTrEOGek5ea5rNPZOgiwjFs"></script>
    <title>根据起点和终点经纬度驾车导航</title>
</head>
<body>
<div id="container"></div>
<div id='result'>根据起点和终点经纬度驾车导航路线</div>
<script>
    var map = new BMapGL.Map("container");
    map.centerAndZoom(new BMapGL.Point(116.404, 39.915), 11);

    var p1 = new BMapGL.Point(116.301934,39.977552);
    var p2 = new BMapGL.Point(116.508328,39.919141);

    var driving = new BMapGL.DrivingRoute(map, {renderOptions:{map: map, autoViewport: true}});
    driving.search(p1, p2);
</script>
</body>
</html>